<ul class="permission">
  <?php foreach( $func_data as $row ) :?>
  <li class="func-tree">
    <div class="func-node" data-func-id="<?php echo $row['id']?>">
      <span class="func" data-id="<?php echo $row['id']?>"><?php echo $row['name'] ?></span>
      <span class="func-opt-row" > 
        <?php foreach( $row['opertation'] as $opt ) :?>
        <span class="func-opt" data-id="<?php echo $opt['id']?>"><i class="fa fa-square-o"></i> <?php echo $opt['name'] ?></span>
        <?php endforeach ; ?>
      </span>
    </div>
    <?php if ( isset( $row['son'] ) ) :?>
    <ul class="sub-permission">
      <?php foreach( $row['son'] as $son ) :?>
      <li class="func-tree">
        <div class="func-node" data-func-id="<?php echo $son['id']?>">
          <span class="func" data-id="<?php echo $son['id']?>"><?php echo $son['name'] ?></span>
          <span class="func-opt-row"> 
            <?php foreach( $son['opertation'] as $opt ) :?>
            <span class="func-opt" data-id="<?php echo $opt['id']?>"><i class="fa fa-square-o"></i> <?php echo $opt['name'] ?></span>
            <?php endforeach ; ?>
          </span>
        </div>
        <?php if ( isset( $son['son'] ) ) :?>
        <ul class="sub-permission">
          <?php foreach( $son['son'] as $s ) :?>
          <li class="func-tree">
            <div class="func-node" data-func-id="<?php echo $s['id']?>">
              <span class="func" data-id="<?php echo $s['id']?>"><?php echo $s['name'] ?></span>
              <span class="func-opt-row"> 
                <?php foreach( $s['opertation'] as $opt ) :?>
                <span class="func-opt" data-id="<?php echo $opt['id']?>"><i class="fa fa-square-o"></i> <?php echo $opt['name'] ?></span>
                <?php endforeach ; ?>
              </span>
            </div>
          </li>
          <?php endforeach ; ?>
        </ul>
        <?php endif ;?>
      </li>
      <?php endforeach ; ?>
    </ul>
    <?php endif ; ?>
  </li>
  <?php endforeach ; ?>
</ul>